from datetime import datetime, timedelta


def get_date(i):
    if i == '昨天':
        date = (datetime.now() - timedelta(days=1)).strftime('%Y-%m-%d')
        return date
    elif i == '半年前':
        # 获取6个月前的日期
        date = (datetime.now() - timedelta(days=180)).strftime('%Y-%m-%d')
        return date
    elif i == '四个月前':
        # 获取4个月前的日期
        date = (datetime.now() - timedelta(days=120)).strftime('%Y-%m-%d')
        return date